#ifndef CAMERA_H_
#define CAMERA_H_

#include "model/point.h"
#include <cmath>

class Camera{
	private:
		Point eye;
		Point at;
		Point up;

		float offset;
		float theta_lr;
		float theta_ud;

		static const float PI = 3.141592654f;
	public:
		Camera(Point eye,Point at,Point up){
			// TODO
		}

		Camera()
			:	eye(0.0f, 10.0f, 3.0f),
				at(0.0f,  0.0f, 0.0f),
				up(0.0f,  0.0f, 1.0f){
			offset = 1.0f;
			theta_ud = 0.0f;
			theta_lr = 0.0f;
		}

		~Camera(){}

		void applyCamera(){
			glMatrixMode(GL_MODELVIEW);
			glLoadIdentity();

			Point neye(eye.x1*offset,eye.x2*offset,eye.x3*offset);

			gluLookAt(neye.x1, neye.x2, neye.x3, at.x1, at.x2, at.x3, up.x1, up.x2, up.x3);

			// Rotacion YZ(UP_DOWN)
			glRotatef(theta_ud,1,0,0);
			// Rotacion en XY(LEFT_RIGHT)
			glRotatef(theta_lr,0,0,1);
		}

		void move(float offset){
			this->offset+=offset;
			if(this->offset<0)
				this->offset=0;
		}

		void rotateUD(float theta){
			this->theta_ud+=theta;
		}

		void rotateLR(float theta){
			this->theta_lr+=theta;
		}
};

#endif /* CAMERA_H_ */
